<template>
	<view class="list-view bg-gray-info">
		<view>

			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">头像</text>
					<view class="list-view-existicon">
						<view class="avatar" v-if="user.sex == 1">
							<image src="../../static/tiezai.png"></image>
						</view>
						<view class="avatar" v-if="user.sex == 0">
							<image src="../../static/ganghua.png"></image>
						</view>
						<!-- <text class="gui-icons list-view-icon">&#xe601;</text> -->
					</view>
				</view>
			</view>

			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">厂牌号</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{user.company_num}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">姓名</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{user.real_name}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">性别</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{user.sex==0?"女":"男"}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">手机号码</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{user.phone_number}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">身份证号</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{idNumber}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br" style="margin-top: 15rpx;">
				<view class="list-view-white">
					<text class="list-view-title">单位</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{user.orgName}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br">
				<view class="list-view-white">
					<text class="list-view-title">在职状态</text>
					<view class="list-view-noicon">
						<text class="list-view-text">{{user.work_status}}</text>
					</view>
				</view>
			</view>
			<view class="list-view-br" @click="team">
				<view class="list-view-white">
					<text class="list-view-title">班组</text>
					<view class="list-view-noicon" v-if="group">
						<text class="list-view-text">{{group.team_name == null ? '无' : group.workshop + ' ' + group.team_name}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				user: [],
				idNumber: null,
				touxiang: '',
				group: [],
				quantity: null,
			}
		},
		onLoad(opt) {
			this.touxiang = opt.img
		},
		onReady() {
			this.user = uni.getStorageSync('userInfo')
			console.log('用户：', this.user);
			this.idNumber = this.maskIdNumber(this.user.id_no)
			this.get_team();
		},
		methods: {
			maskIdNumber(idNumber) { //身份证脱敏
				return idNumber.replace(/(\d{4})\d{10}(\d{4})/, '$1**********$2');
			},
			goBack: function() {
				console.log('res')
				uni.redirectTo({
					url: '/pages/switchPages/my'
				})
			},
			team() {
				let self = this
				// console.log('this.group.com_path_name: ', self.group.com_path_name);
				if (!self.group.team_name) {
					uni.navigateTo({
						url: '/pages/MY/team_group'
					})
				}
			},
			get_team(id) {
				let self = this
				let user = uni.getStorageSync('member')
				let url = '/lgzhsys/getteam'
				let data = {
					id: user.uuid
				}
				this.$boya.NGet(url, data, function(res) {
					console.log('shuju: ', res);
					self.group = res.data
				})
			},
		}
	}
</script>

<style scoped>
	page {
		background: #F0F0F0;
		height: 100%;
	}

	.list-view {
		width: 100%;
		height: 100%;
	}

	.list-info {
		/* background-color: #FFFFFF; */
		padding-top: 90rpx;
	}

	.list-view-br {
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		background-color: white;
	}

	.list-view-white {
		display: flex;
		align-items: center;
		width: 95%;
		height: 100%;
		justify-content: space-between;
		border-bottom: 1rpx solid #F5F5F5;
		margin-left: 36rpx;
	}

	.list-view-title {
		font-size: 35rpx;
		font-weight: 500;
	}

	.list-view-existicon {
		display: flex;
		align-items: center;
		padding-right: 20rpx;
	}

	.list-view-noicon {
		display: flex;
		align-items: center;
		padding-right: 30rpx;
	}

	.list-view-text {
		font-size: 34rpx;
		color: #7A7A7A
	}


	.list-view-icon {
		font-size: 35rpx;
		color: #D1D1D1;
	}

	.bg-gray-info {
		background-color: #F0F0F0;
	}

	.avatar {
		width: 85rpx;
		height: 85rpx;
		border-radius: 10rpx;
		border: 1px solid #c6c6c6;
		border-radius: 50%;
	}

	.avatar image {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
</style>